home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / FileTransfers.h < prev    next >
Text File  |  1991-04-17  |  5KB  |  198 lines

  1. /*
  2.     File:        FileTransfers.h
  3.  
  4.     Contains:    C Interface to the File Transfer Manager
  5.  
  6.     Copyright:    © 1988-1990 by Apple Computer, Inc.
  7.                 All rights reserved.
  8.  
  9. */
  10.  
  11.  
  12. #ifndef __FILETRANSFERS__
  13. #define __FILETRANSFERS__
  14.  
  15. #ifndef __PACKAGES__
  16. #include <Packages.h>
  17. #endif    __PACKAGES__
  18.  
  19. #ifndef __CTBUTILITIES__
  20. #include <CTBUtilities.h>
  21. #endif    __CTBUTILITIES__
  22.  
  23. /* current file transfer manager version    */
  24. #define        curFTVersion        2
  25.  
  26. /* FTErr    */
  27. typedef    OSErr FTErr;
  28.  
  29. #define        ftGenericError        (-1)
  30. #define        ftNoErr                0
  31. #define     ftRejected            1
  32. #define     ftFailed            2
  33. #define     ftTimeOut            3
  34. #define        ftTooManyRetry        4
  35. #define        ftNotEnoughDSpace    5
  36. #define        ftRemoteCancel        6
  37. #define        ftWrongFormat        7
  38. #define        ftNoTools            8    
  39. #define        ftUserCancel        9
  40. #define     ftNotSupported         10
  41.  
  42. /* FTDirection     */
  43. typedef short FTDirection;
  44.  
  45. enum {
  46.     ftReceiving,
  47.     ftTransmitting,
  48.     ftFullDuplex
  49. };
  50.  
  51. /* FTFlags    */
  52. typedef unsigned long FTFlags;
  53.  
  54. enum {
  55.     ftIsFTMode     = 1 << 0,
  56.     ftNoMenus     = 1 << 1,
  57.     ftQuiet     = 1 << 2,
  58.     ftSucc         = 1 << 7
  59. };
  60.  
  61. /* FTAttributes    */
  62. typedef short FTAttributes;
  63. enum {
  64.     ftSameCircuit         = 1 << 0,
  65.     ftSendDisable         = 1 << 1,
  66.     ftReceiveDisable     = 1 << 2,
  67.     ftTextOnly             = 1 << 3,
  68.     ftNoStdFile         = 1 << 4
  69. };
  70.  
  71. /* FTChoose data structures */
  72. struct FTChooseRec {
  73.     long    reserved;
  74.     long    msg;
  75.     ProcPtr    idleProc;
  76.     ProcPtr    filterProc;
  77.     Str63    newTool;
  78.     Ptr        newConfig;
  79.     ProcPtr    eventProc;
  80. };
  81.  
  82. typedef struct FTChooseRec FTChooseRec;
  83.  
  84. typedef FTChooseRec *FTChooseRecPtr;
  85.  
  86. /* FTChooseRec messages */
  87. #define    ftChooseNochange        1
  88. #define    ftChooseBackdoor        2
  89.  
  90.  
  91. struct FTRecord
  92. {    
  93.     short            procID;
  94.  
  95.     FTFlags            flags;
  96.     FTErr            errCode;
  97.  
  98.     long            refCon;
  99.     long            userData;
  100.  
  101.     ProcPtr            defProc;
  102.  
  103.       Ptr                config;
  104.       Ptr                oldConfig;
  105.  
  106.     ProcPtr            environsProc;
  107.     long            reserved1;
  108.     long            reserved2;
  109.         
  110.     Ptr                ftPrivate;
  111.  
  112.      ProcPtr            sendProc;
  113.       ProcPtr            recvProc;
  114.     ProcPtr            writeProc;
  115.     ProcPtr            readProc;
  116.  
  117.      WindowPtr        owner;
  118.     
  119.     FTDirection        direction;
  120.       SFReply            theReply;
  121.  
  122.       long              writePtr;
  123.       long              readPtr;
  124.       char              *theBuf;
  125.     long            bufSize;
  126.     Str255            autoRec;
  127.     FTAttributes    attributes;
  128. };
  129.  
  130. typedef struct FTRecord FTRecord;
  131.  
  132. typedef FTRecord  *FTPtr, **FTHandle;
  133.      
  134.      
  135. #ifdef __cplusplus
  136. extern "C" {
  137. #endif        
  138. pascal FTErr     InitFT(void);
  139. pascal Handle     FTGetVersion(FTHandle hFT);
  140. pascal short     FTGetFTVersion(void);
  141.     
  142. pascal FTHandle FTNew(short procID, FTFlags flags, ProcPtr sendProc, 
  143.                         ProcPtr recvProc, ProcPtr readProc, ProcPtr writeProc, 
  144.                         ProcPtr environsProc, WindowPtr owner, long refCon, 
  145.                         long userData);
  146.  
  147. pascal void     FTDispose(FTHandle hFT);
  148.  
  149. pascal FTErr     FTStart(FTHandle hFT, FTDirection direction, const SFReply *fileInfo);
  150. pascal FTErr     FTAbort(FTHandle hFT);
  151.  
  152. pascal void     FTExec(FTHandle hFT);
  153.  
  154. pascal void     FTActivate(FTHandle hFT, Boolean activate);
  155. pascal void     FTResume(FTHandle hFT, Boolean resume);
  156. pascal Boolean     FTMenu(FTHandle hFT, short menuID, short item);
  157.  
  158. pascal short     FTChoose(FTHandle *hFT, Point where, ProcPtr idleProc);
  159. pascal short     FTPChoose(FTHandle *hFT, Point where, FTChooseRec *cRec);
  160. pascal void     FTEvent(FTHandle hFT, const EventRecord *theEvent);
  161.  
  162. pascal Boolean     FTValidate(FTHandle hFT); 
  163. pascal void     FTDefault(Ptr *theConfig, short procID, Boolean allocate);
  164.  
  165. pascal Handle     FTSetupPreflight(short procID, long *magicCookie);
  166. pascal void     FTSetupSetup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  167.                     long *magicCookie);
  168. pascal Boolean     FTSetupFilter(short procID, const void *theConfig, short count, DialogPtr theDialog,
  169.                     EventRecord *theEvent, short *theItem, long *magicCookie);
  170. pascal void        FTSetupItem(short procID, const void *theConfig, short count, DialogPtr theDialog,
  171.                     short *theItem, long *magicCookie);
  172. pascal void     FTSetupCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  173.                     long *magicCookie);
  174. pascal void     FTSetupXCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  175.                     Boolean OKed, long *magicCookie);
  176. pascal void     FTSetupPostflight(short procID);
  177.  
  178. pascal Ptr         FTGetConfig(FTHandle hFT);
  179. pascal short     FTSetConfig(FTHandle hFT, const void *thePtr);
  180.  
  181. pascal OSErr     FTIntlToEnglish(FTHandle hFT, const void *inputPtr, Ptr *outputPtr, short language);
  182. pascal OSErr     FTEnglishToIntl(FTHandle hFT, const void *inputPtr, Ptr *outputPtr, short language);
  183.  
  184. pascal void     FTSetRefCon(FTHandle hFT, long refCon);
  185. pascal long     FTGetRefCon(FTHandle hFT);
  186.  
  187. pascal void     FTSetUserData(FTHandle hFT, long userData);
  188. pascal long     FTGetUserData(FTHandle hFT);
  189.  
  190. pascal void     FTGetToolName(short procID, Str255 name);
  191. pascal short      FTGetProcID(ConstStr255Param name);
  192.  
  193. pascal void        FTGetErrorString(FTHandle hFT, short id, Str255 errMsg);
  194. #ifdef __cplusplus
  195. }
  196. #endif    
  197.  
  198. #endif __FILETRANSFERS__